<head>
  <meta name="layout" content="main" />
  <title>Atualizar Cadastro</title>
  <link rel="stylesheet" href="${createLinkTo(dir:'css',file:'datarel.css')}" />
  <g:javascript library="jquery"/>
</head>
<body>
  <div class="body">
    <h1>Atualizar cadastro</h1>
    <g:if test="${flash.message}">
      <div class="message">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${person}">
      <div class="errors">
        <g:renderErrors bean="${person}" as="list" />
      </div>
    </g:hasErrors>
    <g:form>
      <g:ifAnyGranted role="ROLE_ADMIN" >
      <input type="hidden" name="id" value="${person.id}" />
      <input type="hidden" name="version" value="${person.version}" />
       <fieldset><legend>Atualizar Usuario</legend>

          <table>
            <tbody>
                 <tr class="prop odd">
              <td valign="top" class="email">
                <label for="email"><g:message code="usuario.passwd.label" default="Endereço eletrônico" /></label>
              </td>
              <td valign="top" class="value ${hasErrors(bean: person, field: 'email', 'errors')}">
                <input name="email" id="email" type="text" onchange="valida(this.value,this.id);" class="big" value="${person?.email?.encodeAsHTML()}" />
            </td>
            </tr>

            <tr class="prop ">
              <td valign="top" class="email">
                <label for="email2"><g:message code="usuario.email2.label" default="Confirme o endereço eletrônico" /></label>
              </td>
              <td valign="top" class="value ${hasErrors(bean: person, field: 'email2', 'errors')}">
            <input name="email2" id="email2" type="text" onchange="valida(this.value,this.id);" class="big" value="${person?.email?.encodeAsHTML()}" />
            </td>
            </tr>
            <tr class="prop">
              <td valign="top" class="userRealName">
                <label for="userRealName"><g:message code="usuario.userRealName.label" default="Nome completo" /></label>
              </td>
              <td valign="top" class="value ${hasErrors(bean: person, field: 'userRealName', 'errors')}">

            <input name="userRealName" id="userRealName"  onchange="valida(this.value,this.id);" class="big" value="${person?.userRealName?.encodeAsHTML()}" />
            </td>
            </tr>
            <tr class="prop odd">
              <td valign="top" class="passwd">
                <label for="passwd"><g:message code="usuario.passwd.label" default="Senha de acesso" /></label>
              </td>
              <td valign="top" class="value ${hasErrors(bean: person, field: 'passwd', 'errors')}">

            <input name="passwd" id="passwd" type="password" onchange="valida(this.value,this.id);" class="medium" value="${person?.passwd?.encodeAsHTML()}" />
            </td>
            </tr>
            <tr class="prop">
              <td valign="top" class="pass">
                <label for="pass"><g:message code="usuario.pass.label" default="Confirme sua senha" /></label>
              </td>
              <td valign="top" class="value ${hasErrors(bean: person, field: 'pass', 'errors')}">
                <input name="pass" id="pass" type="password" onchange="valida(this.value,this.id);" class="medium" value="${person?.passwd?.encodeAsHTML()}" />
            </td>
            </tr>

         
            </tbody>
          </table>

</fieldset>
      




 <div class="row">
 

   <fieldset><legend>Atualizar Permiss&otilde;es</legend>

 


     
        <div class="space-me"><!-- spacer --></div>
        <table class="datagrid">
          <col width="10%" />
          <col width="20%" />
          <col width="70%" />

          <thead>
            <tr>
              <th align="center" ></th>
              <th align="center" >ROLE</th>
              <th align="center" >DESCRIS&Atilde;O </th>

            </tr>
          </thead>
          <tbody>
             <g:each var="entry" in="${roleMap}">


<g:if test="${entry.key.authority != 'ROLE_USERI'}" >

            <tr>

              <td>   <g:checkBox  class="col_1" name="${entry.key.authority}" value="${entry.value}"/> </td>

            <td>${entry.key.authority.encodeAsHTML()}</td>

            <td>${entry.key.description.encodeAsHTML()}</td></tr>
              </g:if>
          </g:each>


          </tbody>
        </table>
         
</fieldset>
 </div>

  </div>
      

          <div class="clear"><!-- clear --></div>
        </div>


       <div class="clear"><!-- clear --></div>
      <div class="row">
        <div class="col_1">
          <g:actionSubmit action="update"
          value="Atualizar" class="cmd green save"/>
        </div>
        <div class="col_2">
          <g:actionSubmit class="cmd green save" action="delete"
          onclick="return confirm('Deseja excluir o Registro Atual?');" value="Excluir" />
        </div>
      </div>
</g:ifAnyGranted>
        </g:form>

</body>
